# -*- coding: utf-8 -*-
"""
Created on Wed Feb 04 07:56:20 2015

@author: 312002
"""
from Tkinter import *
import Tkinter as tk
from random import *
from PIL import Image, ImageTk
class MainClass:

    # Called once when first created
    def __init__(self):
        self.window_width = 1280    # Window properties
        self.window_height = 1024
    #each players character selection
    def char_select(self,sel1,sel2):
        sel1 = input("What character would you like to be(p1)?: ")
        if sel1 == 1:
            self.char1 = ImageTk.PhotoImage(image=Image.open("Pirate1.png"))
        if sel1 == 2:
            self.char1 = ImageTk.PhotoImage(image=Image.open("Bandito1.png"))
        sel2 = input("what character would you like 92 to be?: ")
        if sel2 == 1:
            self.char2 = ImageTk.PhotoImage(image=Image.open("Pirate2.png"))
        if sel2 == 2:
            self.char2 = ImageTk.PhotoImage(image=Image.open("Bandito2.png"))



    # Draw the scene
    def draw(self):
        # Clear canvas
        self.w.delete("all")
    #create the characters
    def Chars(self):
        self.w.create_image(500,215, anchor= tk.NW, image=self.char2)
        self.w.create_image(550,215, anchor= tk.NE, image=self.char1)
        self.w.lift(self.char1)
        self.w.lift(self.char2)
        self.w.pack()
        self.w.after(15,self.Chars)
   
 
    def one_phase(self,onephase1,onephase2,onephase3):
        onephase1 = input("p1 your first strike:")
        onephase2 = input("p1 your second strike:")
        onephase3 = input("p1 your third strike:")
        self.p1phase = 1
        self.p1turn = 1
        self.p1moves = []
        #onephase1 = input("p1 your first strike:")
        self.p1moves.append(onephase1)
        #onephase2 = input("p1 your second strike:")
        self.p1moves.append(onephase2)
        #onephase3 = input("p1 your third strike:")
        self.p1moves.append(onephase3)
        self.p1phase = self.p1phase + 1
        self.p1turn = self.p1turn + 1
        print self.p1moves
        print self.p1phase
        print self.p1turn
    def p2_moves(self, twophase1,twophase2,twophase3):
        self.p2_moves = []
        twophase1 = randint(1,3)
        twophase2 = randint(1,3)
        twophase3 = randint(1,3)
        self.p2_moves.append(twophase1)
        self.p2_moves.append(twophase2)
        self.p2_moves.append(twophase3)
        print self.p2_moves
        
        
   
    def fight(self, self.p1moves,self.p2_moves):
        for At in self.p1moves:
            if At[] == 1 and self.p2_moves[] == 2:
                p1Win = p1win + 1
            else: p2Win = p2Win + 1
        if p1Win = 9:
            print "P1 is the Winner!"
        if p2Win = 9:
            print "P2 is the Winner!"



    def secondary_function(self):
        self.photo = ImageTk.PhotoImage(image=Image.open("background.png"))
        self.w.create_image(16,6 ,anchor= tk.NW, image=self.photo)
        self.w.pack()
    # Run the simulation

    def run(self):
        self.master = tk.Tk()
        self.w = tk.Canvas(self.master, width=self.window_width, height=self.window_height)
        self.w.pack()      # Will call a function after drawing.  This is EXTREMELY useful
        #self.photo = ImageTk.PhotoImage(image=Image.open("background.png"))
        #self.label = Label(self.w, image=self.photo, width=1280, height=1024)
        #self.label.pack()
        self.w.after(0,self.secondary_function)
        self.char_select(1,1)
        self.w.after(5,self.Chars)
        self.w.after(200,self.one_phase(1,2,2))
        self.w.after(250,self.p2_moves(1,1,1))
        tk.mainloop()

program = MainClass()
program.run()
